package com.fjwt.gz.mch.ctrl.assetLevel;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fjwt.gz.core.model.ApiRes;
import com.fjwt.gz.db.vo.AssetMonthVO;
import com.fjwt.gz.db.vo.AssetQuarterVO;
import com.fjwt.gz.mch.ctrl.CommonCtrl;
import com.fjwt.gz.service.impl.AssetMonthService;
import com.fjwt.gz.service.impl.AssetQuarterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("/api/asset")
public class AssetLevelController extends CommonCtrl {

    @Autowired
    private AssetMonthService assetMonthService;
    @Autowired
    private AssetQuarterService assetQuarterService;

/**
   查询用户月度资产等级
 */
    @PostMapping("/selectMonth")
    public ApiRes selectMonth() {
        Long fansId = getCurrentUser().getFansId();
        String locationAgentNo =request.getHeader("locationAgentNo");
        log.info("C端查询用户资产等级，请求地址：/api/asset/selectMonth，请求参数：{},locationAgentN：{}", fansId,locationAgentNo);
        IPage<AssetMonthVO> page = assetMonthService.selectMonth(getIPage(), fansId, locationAgentNo);
        log.info("C端查询用户资产等级，请求地址：/api/asset/selectMonth，返回结果：{}", page);
        return ApiRes.page(page);
    }
/**
   查询用户季度资产等级
*/
    @PostMapping("/selectQuarter")
    public ApiRes selectQuarter() {
        Long fansId = getCurrentUser().getFansId();
        String locationAgentNo =request.getHeader("locationAgentNo");
        log.info("C端查询用户资产等级，请求地址：/api/asset/selectQuarter，请求参数：{},locationAgentN：{}", fansId,locationAgentNo);
        IPage<AssetQuarterVO> page = assetQuarterService.selectQuarterList(getIPage(), fansId, locationAgentNo);
        log.info("C端查询用户资产等级，请求地址：/api/asset/selectQuarter，返回结果：{}", page);
        return ApiRes.page(page);
    }
}
